import { Type } from 'class-transformer'
import { IsEnum, IsInt, IsOptional, IsPhoneNumber, IsString } from 'class-validator'
import { CUserStatus } from '../constant'

export class QueryUserDto {
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  page?: number = 1

  @IsOptional()
  @IsInt()
  @Type(() => Number)
  pageSize?: number = 10

  @IsOptional()
  @IsString()
  userName?: string

  @IsOptional()
  @IsPhoneNumber('CN')
  phone?: string

  @IsOptional()
  @IsString()
  province?: string

  @IsOptional()
  @IsString()
  city?: string

  @IsOptional()
  @IsEnum(CUserStatus)
  @Type(() => Number)
  status?: CUserStatus

  @IsOptional()
  @IsInt()
  @Type(() => Number)
  grade?: number
} 